#pragma once

#include "AbstractEntity.h"
#include "ArmyData.h"
#include "IArmyState.h"
#include "IArmyPhysics.h"
#include "ArmyDataFactory.h"

class ArmyEntity : public AbstractEntity {
protected:
	/* Reference to army data */
	ArmyData* _armyData;
	/* State reference to manage army sprite */
	IArmyState* _armyState;
	/* Shooting refertance to manage army shooting */
	IArmyPhysics* _armyPhysics;
public:

	ArmyEntity() {
	}

	/* Constructor to init data */
	ArmyEntity(int id, int type, double x, double y, Rect* rangeOfEffect);

	/* Init data from factory */
	virtual void initData(int id, int type, double x, double y, Rect* rangeOfEffect);

	/* Get abstract data by parsing ArmyData to AbstractData*/
	virtual AbstractData* getData();

	/* draw army entity */
	virtual void draw(long time);

	/* update army entity */
	virtual void update(long time);

	/* set ref for Pattern, if value is NULL, not set ref */
	virtual void setRefPattern(IArmyState* state, IArmyPhysics* physics);

	/* Set target to army */
	virtual void setTargetRect(Rect* target);

	/*  */
	AbstractData* getAbstractData();

	ArmyData* getArmyData();

	/*init data*/
	virtual void initData();

	virtual void updateData(int type, int action);
};